home *** CD-ROM | disk | FTP | other *** search
- PXFEXECV(3F) Last changed: 2-24-98
-
-
- NNAAMMEE
- PPXXFFEEXXEECCVV, PPXXFFEEXXEECCVVEE, PPXXFFEEXXEECCVVPP - Executes a new process image file
-
- SSYYNNOOPPSSIISS
- SSUUBBRROOUUTTIINNEE PPXXFFEEXXEECCVV ((_p_a_t_h,, _l_e_n_p_a_t_h,, _a_r_g_v,, _l_e_n_a_r_g_v,, _i_a_r_g_c,, _i_e_r_r_o_r))
- IINNTTEEGGEERR _l_e_n_p_a_t_h,, _l_e_n_a_r_g_v((00::_i_a_r_g_c--11)),, _i_a_r_g_c,, _i_e_r_r_o_r
- CCHHAARRAACCTTEERR*_n _p_a_t_h,, _a_r_g_v((00::_i_a_r_g_c--11))
-
- SSUUBBRROOUUTTIINNEE PPXXFFEEXXEECCVVEE ((_p_a_t_h,, _l_e_n_p_a_t_h,, _a_r_g_v,, _l_e_n_a_r_g_v,, _i_a_r_g_c,, _e_n_v,,
- _l_e_n_e_n_v,, _i_e_n_v_c,, _i_e_r_r_o_r))
- IINNTTEEGGEERR _l_e_n_p_a_t_h,, _l_e_n_a_r_g_v((00::_i_a_r_g_c--11)),, _i_a_r_g_c,, _l_e_n_a_r_g_v,, _i_e_n_v_c,, _i_e_r_r_o_r
- CCHHAARRAACCTTEERR*_n _p_a_t_h,, _a_r_g_v((00::_i_a_r_g_c--11)) _e_n_v((_i_e_n_v_c))
-
- SSUUBBRROOUUTTIINNEE PPXXFFEEXXEECCVVPP ((_f_i_l_e,, _l_e_n_f_i_l_e,, _a_r_g_v,, _l_e_n_a_r_g_v,, _i_a_r_g_c,, _i_e_r_r_o_r))
- IINNTTEEGGEERR _l_e_n_f_i_l_e,, _l_e_n_a_r_g_v((00::_i_a_r_g_c--11)),, _i_a_r_g_c,, _i_e_r_r_o_r
- CCHHAARRAACCTTEERR*_n _f_i_l_e,, _a_r_g_v((00::_i_a_r_g_c--11))
-
- IIMMPPLLEEMMEENNTTAATTIIOONN
- UNICOS, UNICOS/mk, and IRIX systems
-
- DDEESSCCRRIIPPTTIIOONN
- On IRIX systems, this routine is in lliibbffoorrttrraann..ssoo which is linked by
- default when compiling programs with the MIPSpro 7 Fortran 90 compiler
- or when compiling programs with the --ccrraayylliibbss option to the MIPSpro
- 7.2 F77 compiler.
-
- The PPXXFFEEXXEECCVV routine uses the eexxeeccvv(2) system call to replace the
- current process image with a new process image.
-
- The PPXXFFEEXXEECCVVEE routine uses the eexxeeccvvee(2) system call to replace the
- current process image with a new process image. The environment
- variables are not inherited from the calling process image. The
- environment variables for the new process image are specified by the
- _e_n_v argument.
-
- The PPXXFFEEXXEECCVVPP routine uses the eexxeeccvvpp(2) system call to replace the
- current process image with a new process image.
-
- When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on
- UNICOS, UNICOS/mk, or IRIX systems, all arguments must be of default
- kind unless documented otherwise. On UNICOS and UNICOS/mk, default
- kind is KKIINNDD==88 for integer, real, complex, and logical arguments; on
- IRIX, the default kind is KKIINNDD==44.
-
- The following is a list of arguments for these routines:
-
- _p_a_t_h An input character variable or array element containing the
- pathname of the new process image file.
-
- _l_e_n_p_a_t_h An input integer variable for the length of _p_a_t_h. If _l_e_n_p_a_t_h
- is zero, trailing blanks are removed.
-
- _f_i_l_e An input character variable or array element containing the
- file of the new process image file. If _f_i_l_e contains a slash
- character, _f_i_l_e will be used as the pathname for the new
- process image file. Otherwise, the directories listed in the
- PPAATTHH environment variable are searched using each directory
- in _p_a_t_h as a pathname prefix for _f_i_l_e.
-
- _l_e_n_f_i_l_e An input integer variable for the length of _f_i_l_e. If _l_e_n_f_i_l_e
- is zero, trailing blanks are removed.
-
- _a_r_g_v An input array of character strings. _a_r_g_v contains the
- arguments to be passed to the new process image.
-
- _l_e_n_a_r_g_v An input array of integers. Each element in _l_e_n_a_r_g_v contains
- the length of the corresponding character string in _a_r_g_v. If
- an element in _l_e_n_a_r_g_v is zero, the corresponding element in
- _a_r_g_v has all trailing blanks stripped.
-
- _i_a_r_g_c An input integer variable. _i_a_r_g_c contains the number of
- arguments to pass to the new process image.
-
- _e_n_v An input array of character strings. _e_n_v contains the
- environment variables for the new process image.
-
- _l_e_n_e_n_v An input array of integers. Each element in _l_e_n_e_n_v contains
- the length of the corresponding character string in _e_n_v. If
- an element in _l_e_n_e_n_v is zero, the corresponding element in
- _e_n_v will have all trailing blanks stripped.
-
- _i_e_n_v_c An input integer variable. _i_e_n_v_c contains the number of
- environment variables for the new process image.
-
- _i_e_r_r_o_r An output integer variable that contains zero if the routine
- was successful or nonzero if the routine was not successful.
-
- The following values may be returned:
-
- EEAACCCCEESS If the new process file is not a regular file, the new
- process image file mode denies execution permission, or
- search permission is denied for a directory listed in the
- new process image file's path prefix.
-
- EENNOOEENNTT If one or more components of the new process image file's
- path name do not exist.
-
- EENNOOEEXXEECC If the new process image file has the appropriate access
- permission but an invalid magic number in its header.
-
- EENNOOMMEEMM If the memory needed to create structures used by the
- routine could not be allocated.
-
- EEIINNVVAALL If _l_e_n_p_a_t_h < 0 or _l_e_n_p_a_t_h > LLEENN((_p_a_t_h)) or any element of
- _l_e_n_a_r_g_v is less than zero or greater than the length of
- the corresponding element in _a_r_g_v.
-
-
- UNICOS and UNICOS/mk only errors:
-
- EE22BBIIGG If the number of bytes in _a_r_g_v is greater than the
- system-imposed limit of AARRGG__MMAAXX found in <<lliimmiittss..hh>>.
-
- EEDDMMOOFFFF If the process image file is offline, and the data
- migration facility is not configured in the system.
-
- EEFFAAUULLTT If the new process image file is not as long as indicated
- by the size values in its header.
-
- EENNOOMMEEMM If the new process requires more memory than is allowed by
- the system-imposed maximum MMAAXXMMEEMM.
-
- EEOOFFFFLLIINN If the process image file is offline, and automatic file
- retrieval is disabled.
-
- EEOOFFLLNNDDDD If the file is offline, and the data management daemon is
- not currently executing.
-
- EEOOFFLLNNNNRR If the file is offline, and it is currently unretrievable.
-
-
- IRIX 6.2 only errors:
-
- EE22BBIIGG If the number of bytes in the new process's argument list
- is greater than the system-imposed limit AARRGG__MMAAXX (see
- ssyyssccoonnff(2), iinnttrroo(2), and lliimmiittss..hh). The argument list
- limit is the sum of the size of the argument list plus the
- size of the environment's exported shell variables.
-
- EE22BBIIGG If the number of bytes in the first line of an interpreter
- file is greater than 256 bytes.
-
- EEAAGGAAIINN If there is not enough memory.
-
- EELLIIBBAACCCC If the required shared library does not have execute
- permission.
-
- EELLIIBBEEXXEECC If _p_a_t_h points to a shared library.
-
- EELLIIBBMMAAXX If the required number of shared libraries exceeds the
- system imposed maximum SSHHLLIIBB__MMAAXX (see iinnttrroo(2)).
-
- EELLOOOOPP If too many symbolic links were encountered in translating
- _p_a_t_h.
-
- EENNAAMMEETTOOOOLLOONNGG
- If the length of _p_a_t_h exceeds PPAATTHH__MMAAXX found in
- <<lliimmiittss..hh>>, or the length of a path component exceeds
- NNAAMMEE__MMAAXX found in <<lliimmiittss..hh>> while PPOOSSIIXX__NNOO__TTRRUUNNCC is in
- effect.
-
- EENNOOEEXXEECC If the executable process image file has badly formed
- header information or the requested virtual addresses are
- not available.
-
- EENNOOMMEEMM If the new process image requires more virtual space than
- is allowed either by the system-imposed maximum or the
- process imposed maximum PPRROOCCSSIIZZEE__MMAAXX (see ggeettrrlliimmiitt(2) and
- iinnttrroo(2)).
-
- EEPPEERRMM If a non-superuser tries to execute a sseettuuiidd file that
- belongs to some other user and the file system in which
- the file resides has been mounted with the nnoossuuiidd option
- (see ffssttaabb(4)), or if a non-superuser attempts to execute
- a setuid or setgid shell script with a UID or GID that is
- different than the user's effective UID/GID, and the
- configured value for nnoo--ssuuiidd--sshheellllss is non-zero (the
- default) (see iinnttrroo(2) and llbboooott(1M)).
-
- EEXXAAMMPPLLEESS
- PPXXFFEEXXEECCVV eexxaammppllee::
- In this example, the program forks and the child calls PPXXFFEEXXEECCVV to
- execute the //bbiinn//ggrreepp process image file. The parent process waits for
- the child to finish executing and then forks again. The child from the
- second fork also calls PPXXFFEEXXEECCVV to execute the //bbiinn//ggrreepp process image
- file. The parent then waits for the child to finish executing.
-
- program test
- integer ipid, ierror, lenpath, lenargv(3), iargc, iretpid
- integer istat
- character*30 path, argv(3)
-
- path = '/bin/grep'
- lenpath = 0
- iargc = 3
- argv(1) = 'grep'
- lenargv(1) = 0
- argv(2) = 'root'
- lenargv(2) = 0
- argv(3) = '/etc/passwd'
- lenargv(3) = 0
-
-
- CALL PXFFORK(ipid,ierror)
- if (ierror .ne. 0) then
- print *,'FAILED: PXFFORK call with error = ',ierror
- else
- if (ipid .eq. 0) then
- print *,'CHILD1: execing grep'
- CALL PXFEXECV(path, lenpath, argv, lenargv, iargc, ierror)
- print *,'FAILED: PXFEXEC call with error = ',ierror
- stop
- else
- print *,'PARENT: waiting for CHILD1'
- CALL PXFWAIT(istat,iretpid,ierror)
- print *,'PARENT: CHILD1 finished. Forking off CHILD2'
- CALL PXFFORK(ipid, ierror)
- if (ipid .eq. 0) then
- print *,'CHILD2: execing grep'
- CALL PXFEXECV(path, lenpath, argv, lenargv, iargc, ierror)
- print *,'FAILED PXFEXEC call with error = ',ierror
- stop
- else
- print *,'PARENT: waiting for CHILD2'
- CALL PXFWAIT(istat,iretpid,ierror)
- print *,'PARENT: CHILD2 finished.'
- print *,'PASSED: PXFEXECV normal test'
- endif
- endif
- endif
- end
-
- PPXXFFEEXXEECCVVEE eexxaammppllee::
- In this example, the program forks and the child calls PPXXFFEEXXEECCVVEE to
- execute the //bbiinn//ggrreepp process image file. The parent process waits for
- the child to finish executing and then forks again. The child from the
- second fork also calls PPXXFFEEXXEECCVVEE to execute the //bbiinn//ggrreepp process
- image file. The parent then waits for the child to finish executing.
-
- integer ipid, ierror, lenpath, lenargv(3), iargc, iretpid
- integer istat, errorcondition, lenenv(3), ienvc
- character*30 path, argv(3)
- character*30 env(3)
-
- path = '/bin/grep'
- lenpath = 0
- iargc = 3
- argv(1) = 'grep'
- lenargv(1) = 0
- argv(2) = 'root'
- lenargv(2) = 0
- argv(3) = '/etc/passwd'
- lenargv(3) = 0
- ienvc = 3
- env(1) = 'TERM=vt100'
- lenenv(1) = 0
- env(2) = 'SHELL=/bin/csh'
- lenenv(2) = 0
- env(3) = 'DISPLAY=:0.0'
- lenenv(3) = 0
-
- CALL PXFFORK(ipid,ierror)
- if (ierror .ne. 0) then
- print *,'FAILED: PXFFORK call with error = ',ierror
- else
- if (ipid .eq. 0) then
- print *,'CHILD1: execing grep'
- CALL PXFEXECV(path, lenpath, argv, lenargv, iargc, ierror)
- print *,'FAILED: PXFEXEC call with error = ',ierror
- stop
- else
- print *,'PARENT: waiting for CHILD1'
- CALL PXFWAIT(istat,iretpid,ierror)
- print *,'PARENT: CHILD1 finished. Forking off CHILD2'
- CALL PXFFORK(ipid, ierror)
- if (ipid .eq. 0) then
- print *,'CHILD2: execing grep'
- CALL PXFEXECV(path, lenpath, argv, lenargv, iargc, ierror)
- print *,'FAILED PXFEXEC call with error = ',ierror
- stop
- else
- print *,'PARENT: waiting for CHILD2'
- CALL PXFWAIT(istat,iretpid,ierror)
- print *,'PARENT: CHILD2 finished.'
- print *,'PASSED: PXFEXECVP normal test'
- endif
- endif
- endif
- end
-
- PPXXFFEEXXEECCVVPP eexxaammppllee::
- In this example, the program forks and the child calls PPXXFFEEXXEECCVVPP to
- execute the grep process image file. The parent process waits for the
- child to finish executing and then forks again. The child from the
- second fork also calls PPXXFFEEXXEECCVVPP to execute the grep process image
- file. The parent then waits for the child to finish executing.
-
- program test
- integer ipid, ierror, lenfile, lenargv(3), iargc, iretpid
- integer istat
- character*30 file, argv(3)
-
- file = 'grep'
- lenfile = 0
- iargc = 3
- argv(1) = 'grep'
- lenargv(1) = 0
- argv(2) = 'root'
- lenargv(2) = 0
- argv(3) = '/etc/passwd'
- lenargv(3) = 0
-
-
- CALL PXFFORK(ipid,ierror)
- if (ierror .ne. 0) then
- print *,'FAILED: PXFFORK call with error = ',ierror
- else
- if (ipid .eq. 0) then
- print *,'CHILD1: execing grep'
- CALL PXFEXECVP(file, lenfile, argv, lenargv, iargc, ierror)
- print *,'FAILED: PXFEXEC call with error = ',ierror
- stop
- else
- print *,'PARENT: waiting for CHILD1'
- CALL PXFWAIT(istat,iretpid,ierror)
- print *,'PARENT: CHILD1 finished. Forking off CHILD2'
- CALL PXFFORK(ipid, ierror)
- if (ipid .eq. 0) then
- print *,'CHILD2: execing grep'
- CALL PXFEXECVP(file, lenfile, argv, lenargv, iargc, ierror)
- print *,'FAILED PXFEXEC call with error = ',ierror
- stop
- else
- print *,'PARENT: waiting for CHILD2'
- CALL PXFWAIT(istat,iretpid,ierror)
- print *,'PARENT: CHILD2 finished.'
- print *,'PASSED: PXFEXECVP normal test'
- endif
- endif
- endif
- end
-
- SSEEEE AALLSSOO
- eexxeeccvv(2)
-
- _A_p_p_l_i_c_a_t_i_o_n _P_r_o_g_r_a_m_m_e_r'_s _L_i_b_r_a_r_y _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l, publication
- SR-2165, for the printed version of this man page.
-